package com.lv.suyiyong.hfr.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.lv.suyiyong.hfr.R;
import com.youth.banner.adapter.BannerAdapter;
import com.youth.banner.util.BannerUtils;

import java.util.List;

/**
 * 自定义布局，实现类似1号店、淘宝头条的滚动效果
 */
public class CompanyLedAdapter extends BannerAdapter<String, CompanyLedAdapter.TopLineHolder> {

    public CompanyLedAdapter(List<String> mDatas) {
        super(mDatas);
    }

    @Override
    public TopLineHolder onCreateHolder(ViewGroup parent, int viewType) {
        return new TopLineHolder(BannerUtils.getView(parent, R.layout.item_company_led));
    }

    @Override
    public void onBindView(TopLineHolder holder, String data, int position, int size) {
        holder.tvName.setText(data);
    }

    class TopLineHolder extends RecyclerView.ViewHolder {
        public TextView tvName;
        public TextView source;

        public TopLineHolder(@NonNull View view) {
            super(view);
            tvName = view.findViewById(R.id.tv_name);
        }
    }
}
